<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        tr,th,td{
            padding: 5px;
            border: 1px solid black;
        }
        .red{
            background-color: blueviolet;
        }
        .green{
            background-color: chartreuse;
        }
    </style>
</head>
<body>
    <h2><%= title %></h2>
    <table>
        <tr>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
        </tr>
        <% for(let item of result){ %>
           <% if(item.sex=="男"){ %>
            <tr class="green">
        <% }else{ %>
            <tr class="red">
        <% } %>
                <td><%= item.name %></td>
                <td><%= item.sex %></td>
                <td><%= item.age %></td>
            </tr>
            <% } %> 
    </table>
</body>
</html>